package com.srcptit.java.training.dungvv.btvn1;
//nguyen to co 7 chu so
//cac chu so la nguyen to
//tao thanh day khong giam tu hang trieu->don vi
public class B8 {
	public static boolean ngto(long n){
		int dem = 0;
		for(int i = 1; i <= n; i++)
			if (n % i == 0)  
				dem++;
		if (dem == 2)
			return true;
		return false;
	}
	public static boolean chuso(long n){
		while (n > 0){
			if ((n % 10 != 2)&&(n % 10 != 3)&&(n % 10 != 5)&&(n % 10 != 7))
				return true;
			n = n / 10;
		}
		return false;
	}
	public static boolean giam(long n){
		while (n > 0){
			if((n / 10) % 10 > n % 10)  
				return true;
			n = n / 10;
		}
		return false;
	}
	public static void main(String [] args){
		for(long i = 1000001; i < 10000000; i = i + 2)
			if(chuso(i))
				if(giam(i))
					if(ngto(i))
						System.out.print(i+ " ");
	}
}
